<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ClientScript
 *
 * @author Chris Sim
 */
class ClientScript extends CClientScript
{
        public $defaultJuiTheme = 'flick';
        public $juiScriptFile = 'jquery-ui.min.js';
        public $juiCssFile = 'jquery.ui.all.css';
        public $juiI18nScriptFile = 'jquery-ui-i18n.js';

        public function registerjuiScripts($cssFile = '', $theme = '', $useI18n = false, $position=ClientScript::POS_END)
        {
                if($cssFile === '')
                        $cssFile = $this->juiCssFile;
                if($theme === '')
                        $theme = $this->defaultJuiTheme;

                $basePath=Yii::getPathOfAlias('zii.vendors.jui');
                $baseUrl=Yii::app()->getAssetManager()->publish($basePath, true);

                $scriptUrl=$baseUrl.'/js';
                $cssUrl=$baseUrl.'/css';

                $this->registerCssFile($cssUrl.'/'.$theme.'/'.$cssFile);
                $this->registerCoreScript('jquery');
                $this->registerScriptFile($scriptUrl.'/'.$this->juiScriptFile, $position);
                if($useI18n)
                        $this->registerScriptFile($scriptUrl.'/'.$this->juiI18nScriptFile, $position);
        }
}
?>
